<%@page import="org.jeecgframework.web.util.StaticValue"%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title>巡检计划详情</title>
	<t:base type="jquery,easyui,tools,DatePicker"></t:base>
	<script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
<script type="text/javascript">
$(function(){
	var form = $("#planDetail").Validform({
		ignoreHidden:true,
		postonce:true,
		ajaxPost:true,
		tiptype:'3',
		callback:function(data){
			if(data.success){
				window.top.$("#maintabs").tabs({
					onBeforeClose : function(title,index){
						try {
							window.top.$("#maintabs").tabs('select','巡检任务');
							window.top.tip(data.msg);
							if(top.myTabWin.reloadTable()){
								top.myTabWin.reloadTable();
							}
						} catch (e) {
						} finally{
							return true;
						}
					}
				});
				window.top.$("#maintabs").tabs('close','任务详情');
			}else{
				tip(data.msg);
			}
		}
	});
	$("#save").click(function(){
		$.dialog.confirm("确认保存巡检任务吗？",function(r){
			if(r){
				$.ajax({
					url : "zyInspectionPlanController.do?doJudgeForEgUpdateEgOrderTime",
					data : {
						"id" : '${zyIP.id}'
						},
					cache : false,
					dataType : 'json',
					type : 'POST',
					async : false,
					success : function(data){
						if(data.success){
							form.submitForm(false,"zyInspectionPlanController.do?doEngineerUpdateIp");
						}else{
							tip(data.msg);
						}
					}
				});
			}
		});
	});
	
	$("#viewIpReport").click(function(){
		viewOrUpdateIReport("view");
	});
	drawPlanRecordTable('${zyIP.id}');
});
//查看巡检报告
function viewOrUpdateIReport(operationType){
	var title = "";
	if(operationType == "view"){
		title = "查看巡检报告";
	}
	addOneTab(title,"zyInspectionReportController.do?goViewOrUpateIr&zyIpId=${zyIP.id }&operationType="+operationType);
}
</script>
</head>
<body>
<div><span class="navtitle">巡检计划ID：</span><span class="navid">${zyIP.planId }</span></div>
<div class="subtitle"><p>巡检计划信息</p>
	<table class="nobordertable noborder">
		<tr>
			<td class="al_r" width="20%">
				<label>设备SN:</label>
			</td>
			<td width="20%">
				<span>${zyES.sn }</span>
			</td>
			<td class="al_r" width="30%">
				<label>设备型号:</label>
			</td>
			<td width="30%">
				<span>${zyES.type.typeDesc }</span>
			</td>
		</tr>
		<tr>
			<td class="al_r">
				<label>影院名称:</label>
			</td>
			<td>
				<span>${zyES.zyCinema.name }</span>
			</td>
			<td class="al_r">
				<label>影院地址:</label>
			</td>
			<td>
				<span>${zyES.zyCinema.address }</span>
			</td>
		</tr>
		<tr>
			<td class="al_r">
				<label>影院巡检负责人:</label>
			</td>
			<td>
				<span>${zyCmIpContact.name }</span>
			</td>
			<td class="al_r">
				<label>影院巡检负责人电话:</label>
			</td>
			<td>
				<span>${zyCmIpContact.cellphone1 } / ${zyCmIpContact.cellphone2 }</span>
			</td>
		</tr>
		<tr>
			<td class="al_r">
				<label>影院技术主管:</label>
			</td>
			<td>
				<c:if test="${!empty cinemaContact }" ><span>${cinemaContact.name}</span></c:if>
			</td>
			<td class="al_r">
				<label>影院技术主管电话:</label>
			</td>
			<td>
				<c:if test="${!empty cinemaContact }" ><span>${empty cinemaContact.cellphone1 ? cinemaContact.cellphone2 : cinemaContact.cellphone1 }</span></c:if>
			</td>
		</tr>
		<tr>
			<td class="al_r">
				<label>巴可派单时间:</label>
			</td>
			<td>
				<span><fmt:formatDate  value="${zyIP.sendToTpTime }" type="both" pattern="yyyy/MM/dd" /></span>
			</td>
			<td class="al_r">
				<label>巡检单状态:</label>
			</td>
			<td>
				<span>${zyIP.stateVal }</span>
			</td>
		</tr>
	</table>
	</div>
<t:formvalid action="zyInspectionPlanController.do?doEngineerUpdateIp" dialog="" layout="" formid="planDetail">
	<input type="hidden" value="${zyIP.id }" id="id" name="id"/>
<%--	<c:set var="btnSavePlanFlag" value="false"/>--%>
<%--	<c:forEach items="${btnSavePlanRules }" var="item">--%>
<%--		<c:if test="${zyIP.state eq item }"><c:set var="btnSavePlanFlag" value="true"/></c:if>--%>
<%--	</c:forEach>--%>
	<div class="subtitle">
		<p>巡检任务说明</p>
		<table class="nobordertable noborder">
			<tr>
				<td class="al_r" width="20%">
					<label>光路要求:</label>
				</td>
				<td>
					<span>${zyIP.lightPathVal }</span>
				</td>
				<td class="al_r" width="20%">
					<label>计划巡检月份:</label>
				</td>
				<td width="30%">
					<fmt:formatDate  value="${zyIP.ipPlanDate }" type="both" pattern="yyyy年-MM月" />
				</td>
				<%--<td class="al_r" width="20%">
					<label>服务日:</label>
				</td>
				<td>
					<fmt:formatDate  value="${zyIP.orderBeginTime }" type="both" pattern="yyyy-MM-dd" />~<fmt:formatDate  value="${zyIP.orderEndTime }" type="both" pattern="yyyy-MM-dd" />
				</td>--%>
			</tr>
			<tr>
				<td class="al_r">
					<label>工程师:</label>
				</td>
				<td>
					<span>${zyIP.engineer.name }</span>&nbsp;&nbsp;
					<span>${zyIP.engineer.cellphone }</span>
				</td>
				<td class="al_r">
					<label>预约上门时间:</label>
				</td>
				<td>
					<span>
						<c:if test="${zyIP.engineerOrderTimeCount < 2 && btnSavePlanFlag}" >
							<input id="engineerOrderTime" class="Wdate" value="<fmt:formatDate  value="${zyIP.engineerOrderTime }" type="both" pattern="yyyy-MM-dd" />" 
								onClick="WdatePicker({minDate:'%y-%M-%d'})" 
								name="engineerOrderTime" type="text" style="width: 150px" class="inputxt" datatype="*">
						</c:if>
						<c:if test="${zyIP.engineerOrderTimeCount > 2 && !btnSavePlanFlag && empty zyIP.engineerOrderTime}" >无</c:if>
						<c:if test="${zyIP.engineerOrderTimeCount >= 2 && !empty zyIP.engineerOrderTime || !btnSavePlanFlag}" >
							<fmt:formatDate  value="${zyIP.engineerOrderTime }" type="both" pattern="yyyy-MM-dd" />
						</c:if>
					</span>
					<br /><span style="color:blue;font-size:10px;">说明：接受任务后须在与影院约好上门时间后填写【预约上门时间】<br>否则将无法提交完工报告。</span>
				</td>
			</tr>
			<tr>
				<td class="al_r" >
					<label>巡检任务备注:</label>
				</td>
				<td style="width: 29%;">
					<span style="word-wrap : break-word ;word-break: break-all;">${zyIP.remarks }</span>
				</td>
				<td class="al_r" >
					<label>工程师备注:</label>
				</td>
				<td style="width: 29%;">
					<c:if test="${zyIP.engineerOrderTimeCount < 2 && btnSavePlanFlag}" >
						<textarea rows="5" cols="60" name="engineerRemark" datatype="*1-500" maxlength="500">${zyIP.engineerRemark }</textarea>
					</c:if>
					<c:if test="${zyIP.engineerOrderTimeCount > 2 && !btnSavePlanFlag && empty zyIP.engineerRemark}" >无</c:if>
					<c:if test="${zyIP.engineerOrderTimeCount >= 2 && !empty zyIP.engineerRemark}" >
						<span style="word-wrap : break-word ;word-break: break-all;">${zyIP.engineerRemark }</span>
					</c:if>
				</td>
			</tr>
			<c:if test="${zyIP.engineerOrderTimeCount < 2 && btnSavePlanFlag}" >
				<tr>
					<td colspan="4" style="text-align: center;">
						<a href="#" class="easyui-linkbutton" id="save">保存</a>
					</td>
				</tr>
			</c:if>
		</table>
	</div>
</t:formvalid>
<div class="subtitle">
	<p>设备相关信息</p>
	<table class="nobordertable noborder">
		<tr>
			<td class="al_r" width="20%">
				<label>去年巡检日期:</label>
			</td>
			<td width="20%">
				<span><fmt:formatDate  value="${zyES.lastYearInspectionDate }" type="both" pattern="yyyy-MM-dd" /></span>
			</td>
			<td class="al_r" width="30%">
				<label>安装日期:</label>
			</td>
			<td width="30%">
				<span><fmt:formatDate  value="${zyES.installDate }" type="both" pattern="yyyy-MM-dd" /></span>
			</td>
		</tr>
		<tr>
			<td class="al_r">
				<label>所属厅:</label>
			</td>
			<td>
				<span>${zyES.house.roomNum }</span>
			</td>
			
			<td class="al_r">
				<label>银幕类型:</label>
			</td>
			<td>
				<span>${zyES.house.screenType }</span>
			</td>
		</tr>
		<tr>
			<td class="al_r">
				<label>放映距离:</label>
			</td>
			<td>
				<span>${zyES.house.showKm }</span>
			</td>
			<td class="al_r">
				<label>银幕增益:</label>
			</td>
			<td>
				<span>${zyES.house.screenPlus }</span>
			</td>
		</tr>
		<tr>
			<td class="al_r">
				<label>宽银幕高:</label>
			</td>
			<td>
				<span>${zyES.house.screenHight }</span>
			</td>
			<td class="al_r">
				<label>宽银幕宽:</label>
			</td>
			<td>
				<span>${zyES.house.screenWidth }</span>
			</td>
		</tr>
		<tr>
			<td class="al_r">
				<label>宽银幕镜头比:</label>
			</td>
			<td>
				<span>${zyES.house.screenLensRatio }</span>
			</td>
			<td class="al_r">
				<label>遮幅镜头比:</label>
			</td>
			<td>
				<span>${zyES.house.curtainLensRatio }</span>
			</td>
		</tr>
		<tr>
			<td class="al_r">
				<label>是否激光改造:</label>
			</td>
			<td>
				<c:if test="${not empty zyES.laserReconstruction}" >
					<span>${zyES.laserReconstruction eq 1 ? '是' : '否'}</span>
				</c:if>
				<c:if test="${empty zyES.laserReconstruction}" >
					<span>无</span>
				</c:if>
			</td>
			<td></td>
			<td></td>
		</tr>
		<c:if test="${viewOrUpdateReportFlag == '1'}">
			<tr>
				<td colspan="4" style="text-align: center;">
					<a href="#" class="easyui-linkbutton" id="viewIpReport">查看巡检报告</a>
				</td>
			</tr>
		</c:if>
	</table>
</div>
<div class="subtitle">
	<p>流程流转历史</p>
	<div id="planRecordDiv"></div>
</div>
</body>
